package ua.kyivenergo.cableLines.data.attributes;

import ua.kyivenergo.cableLines.search.SearchComparator;

import static ua.kyivenergo.cableLines.data.attributes.AttributeTypes.*;

/**
 * Created by Alex Kebkalo (kebka@mail.ru) on 18.04.14.
 */
public class StringAttribute extends Attribute {
    private String value;

    public StringAttribute(String value, String description) {
        super(description);
        this.value = value;
    }

    @Override
    public int getAttributeType() {
        return StringAttribute;
    }

    public String getValue() {
        return value;
    }

    @Override
    public double getRelevance(String searchString) {
        return SearchComparator.compareStrings(value, searchString);
    }

    @Override
    public String toString() {
        return value;
    }
}
